/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.nms.entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author mohamedemara
 */
@Embeddable
public class StatusPK implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "offer_id")
    private String offerId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "customer_id")
    private String customerId;
    @Basic(optional = false)
    @NotNull
    @Column(name = "date_change")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateChange;

    public StatusPK() {
    }

    public StatusPK(String offerId, String customerId, Date dateChange) {
        this.offerId = offerId;
        this.customerId = customerId;
        this.dateChange = dateChange;
    }

    public String getOfferId() {
        return offerId;
    }

    public void setOfferId(String offerId) {
        this.offerId = offerId;
    }

    public String getCustomerId() {
        return customerId;
    }

    public void setCustomerId(String customerId) {
        this.customerId = customerId;
    }

    public Date getDateChange() {
        return dateChange;
    }

    public void setDateChange(Date dateChange) {
        this.dateChange = dateChange;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (offerId != null ? offerId.hashCode() : 0);
        hash += (customerId != null ? customerId.hashCode() : 0);
        hash += (dateChange != null ? dateChange.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof StatusPK)) {
            return false;
        }
        StatusPK other = (StatusPK) object;
        if ((this.offerId == null && other.offerId != null) || (this.offerId != null && !this.offerId.equals(other.offerId))) {
            return false;
        }
        if ((this.customerId == null && other.customerId != null) || (this.customerId != null && !this.customerId.equals(other.customerId))) {
            return false;
        }
        if ((this.dateChange == null && other.dateChange != null) || (this.dateChange != null && !this.dateChange.equals(other.dateChange))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.nms.entities.StatusPK[ offerId=" + offerId + ", customerId=" + customerId + ", dateChange=" + dateChange + " ]";
    }
    
}
